#include "tinyrpc/net/timerque.h"
#include "tinyrpc/net/eventloop.h"
#include <iostream>
#include "tinyrpc/base/task.h"
using namespace TinyRPC;
void timetask1(){
    std::cout<<"timer 1" <<std::endl;
}

void timetask2(){
    std::cout<<"timer 2" <<std::endl;
}
int main(){
    TimerQueue timerQueue;
    Timer timer(TimeStamp::Now() + 2*TimeStamp::kMicroSecPerSecond, 2*TimeStamp::kMicroSecPerSecond, Task(timetask1, false));
    Timer timer2(TimeStamp::Now() + 1.5*TimeStamp::kMicroSecPerSecond, 1*TimeStamp::kMicroSecPerSecond, Task(timetask2, false));
    timerQueue.addTimer(timer);
    timerQueue.addTimer(timer2);
    while (1)
    {
        timerQueue.timerQueueTask();
    }

    // EventLoop eventLoop;
    // eventLoop.runEvery(5,2,Task(timetask1, false));
    // eventLoop.loop();
    
    
}